package cat.joronya.supermanager.service;

import android.os.Message;
import android.util.Log;
import cat.joronya.supermanager.Supermanager;

public abstract class JoinPrivateLeagueHandler extends BaseHandler {

	@Override
	public void handleMessage(Message msg) {
		// get data from msg
		status = msg.getData().getInt(Supermanager.STATUS_MESSAGE);
		Log.d(TAG, "JoinPrivateLeagueHandler received status: " + status);

		switch(status) 
		{
			case Supermanager.PRIVATE_LEAGUE_JOIN_OK:
				joinOk(msg);
				break;
			case Supermanager.PRIVATE_LEAGUE_WRONG_PASSWORD:
				wrongPassword(msg);
				break;
			case Supermanager.PRIVATE_LEAGUE_MAX_TEAM_REACHED:
				maxTeamReached(msg);
				break;
			case Supermanager.PRIVATE_LEAGUE_MAX_TEAM_PER_PLAYER_REACHED:
				matTeamPerPlayerReached(msg);
				break;
		}

		super.handleMessage(msg);
	}

	/**
	 * Executed when received PRIVATE_LEAGUE_JOIN_OK
	 */
	public abstract void joinOk(Message msg);

	/**
	 * Executed when received PRIVATE_LEAGUE_WRONG_PASSWORD
	 */
	public abstract void wrongPassword(Message msg);

	/**
	 * Executed when received PRIVATE_LEAGUE_MAX_TEAM_REACHED
	 */
	public abstract void maxTeamReached(Message msg);

	/**
	 * Executed when received PRIVATE_LEAGUE_MAX_TEAM_PER_PLAYER_REACHED
	 */
	public abstract void matTeamPerPlayerReached(Message msg);

}
